perm filename ALHEAD.PAL[AL,HE]29 blob sn#564551 filedate 1981-02-18 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.SBTTL  Switches, absolute locations, registers, mark instructions
C00005 00003	Routine calling and defining macros  ROUTINE, CALL
C00008 00004	Macros: ASCIE,PUSH,POP,TELL,INFO,XX,TT,PUTLOC,ALWARN,ALERR,PUNT,CODE,DATA
C00013 00005	Separate assembly communication facility COMTAB
C00020 ENDMK
C⊗;
.SBTTL  Switches, absolute locations, registers, mark instructions

;This macro gives the switch SW a default value VAL
	.MACRO STSW SW,VAL
	.IFNDF SW
	SW == VAL   ;if do not have a value already, give it one
	.ENDC
	.ENDM



; PROGRAM DEFINITIONS

;  Refer to UNIBUS.BO[11,DOC] for all absolute location meanings

ERRTRP==4		;time out and error trap
ILGINS==10		;illegal instruction
CLKTRP==104		;clock trap
DACVEC==130		;DAC interrupt vector
ADCVEC==134		;ADC interrupt vector
ARMTRP==200		;Arm error interrupt vector
YTRP==314		;Yellow arm panic interupt (channel B)
DDT=130000		;Restart of DDT
PS=177776		;processor status word
VITTS==170777		;Video Intensity Table Table Select
VIT==171000		;Video Intensity Table (400 words long)
KBIS==177560		;keyboard input status
KBIR==177562		;keyboard input register
KBOS==177564		;keyboard output status
KBOR==177566		;keyboard output register
CLKCNT==172544		;clock counter
CLKSET==172542		;clock set register
CLKS==172540		;clock status

HCOR==157776		;highest useable word in core
OREG==274 ;was HCOR	;put something here, 11TTY will print it on console
IREG==272 ;was HCOR-2	;11TTY puts stuff here for console input
OUTSW==270 ;was HCOR-4	;0 => your console; -1 => VT05

;REGISTER DEFINITIONS

PC=%7			;program counter
SP=%6			;stack pointer

RF==%5			;Display pointer
SG==%5			;string pointer
R5=%5

R4=%4			;Saved across procedure calls
R3=%3			;Saved across procedure calls
R2=%2			;Saved across procedure calls
R1=%1			;temp
R0=%0			;temp
AC5==%5			;Temp Floating point register
AC4==%4			; "      "	"      "
AC3==%3			; "      "	"      "
AC2==%2			; "      "	"      "
AC1==%1			; "      "	"      "
AC0==%0			; "      "	"      "

;Routine calling and defining macros  ROUTINE, CALL
;Coded by RHT 9/74. modified to eliminate use of the MARK instruction by ARG 9/77

;This should be used at the start of routines which reference
;	parameters off the RF stack.  It gives the parameters
;	symbolic names for clarity of coding.
;For example,
;
;	ROUTINE FOO,<A,B>
;
;Goes to
;
;	A==4
;	B==2
;FOO:

	.MACRO ROUTINE ID,ARGS
	    .IFNB ARGS
	    NNNN==0
		.IRP II,<ARGS>		;Raise NNNN to twice the number of args.
		     NNNN==NNNN+2
		.ENDM
		.IRP II,<ARGS>		;Assign each arg NNNN and decrease same.
		    .IFDF II
			 .IF1 
			      .ERROR Multiple definition for II
			 .ENDC
		    .ENDC
		     II == NNNN
		     NNNN == NNNN-2
		.ENDM
	   .ENDC
ID:
	.ENDM

;This is useful in calling rountines which reference parameters off
;	the RF stack.  It sets up the stack properly, but does not
;	save R0 or R1.

	.MACRO CALL ID,ARGS
	   .IFNB ARGS
		nn == 0
		.IRP II,<ARGS>
		MOV II,-(SP)	;Push an argument
		nn == nn + 2	;Keep track of how many words we've pushed
		.ENDM
		MOV RF,-(SP)	;Save RF
		MOV SP,RF	;Set up the display in RF.
	   .ENDC
	JSR PC,ID		;Call the routine
	   .IFNB ARGS
		MOV (SP)+,RF	;Restore RF
		ADD #nn,SP	;Pop args off of stack
	   .ENDC
	.ENDM

;This macro is a temporary method of defining floating point
;constants. LABIL is the constant name and MSB and LSB its two
;16 bit octal parts.

       .MACRO FP  LABIL,MSB,LSB
	.MACRO  LABIL
	 	.WORD	MSB,LSB	
	.ENDM
       .ENDM

;Macros: ASCIE,PUSH,POP,TELL,INFO,XX,TT,PUTLOC,ALWARN,ALERR,PUNT,CODE,DATA

.MACRO ASCIE STR
       .ASCIZ STR
       .EVEN
       .ENDM

.MACRO	PUSH X
	.IRP Y,<X>
	MOV Y,-(SP)
	.ENDM
	.ENDM

.MACRO	POP X
	.IRP Y,<X>
	MOV (SP)+,Y
	.ENDM
	.ENDM

.MACRO 	PUSHF X			; PUSH X ONTO SYSTEM STACK (X IS FLOATING-PT)
	STF	X,-(SP)
	.ENDM

.MACRO	POPF X			; POP X FROM SYSTEM STACK (X IS FLOATING-PT)
	LDF	(SP)+, X
	.ENDM

.MACRO	CHECKF	X		; TEST X AND COPY CONDITION CODES INTO NORMAL ONES
	TSTF	X
	CFCC			;COPY FLOATING CONDITION CODES
	.ENDM

.MACRO	COMPF	X,Y		;FLOATING COMPARE X AND Y AND COPY CONDITION CODES
	CMPF	X,Y		;FLOATING COMPARE
	CFCC			;COPY CONDITION CODES
	.ENDM

.MACRO	COPYF	X,Y		;FLOATING COPY X TO Y 
	MOV     X,Y
	MOV	X+2,Y+2
	.ENDM

.MACRO	EXCHGF	X,Y		;FLOATING EXCHANGE X AND Y
	PUSH 	X
	PUSH	X+2
	PUSH 	Y
	PUSH    Y+2
	POP 	X+2
	POP	X
	POP	Y+2
	POP	Y
	.ENDM

.MACRO	GOSUB	RTN		;SAME AS "JSR PC,RTN"
	JSR	PC,RTN
	.ENDM

.MACRO	TELL VAR
	TELL2 VAR,\VAR
	.ENDM

.MACRO	TELL2 S,V
	.PRINT /S = /
	.PRINT /V
/
	.ENDM

.MACRO	.INFO STR,NUM
	.PRINT /STR/
	.PRINT /NUM
/
	 .ENDM

.MACRO	XX SYM			;Just gives SYM the next number.
	.IFDF SYM
	  .IFNZ SYM-II
	    .IF1
	    .ERROR You are using SYM in two ways!!!
	    .ENDC
	  .ENDC
	.ENDC
	 SYM == II
	 II == II+2
	.ENDM

.MACRO	TT INX,VAL		;To store data at an offset from II
	.=II+INX
	 VAL
	.ENDM

.MACRO	PUTLOC	ADR,VAL
	 II==.
	 .= ADR
	 VAL
	.=II
	.ENDM

.MACRO	ALWARN MES		;Error.  Type warning message.
	MOV #MES,-(SP)		;Push the message pointer
	JSR PC,TYPWARN		;Call the warning message utility routine.
	.ENDM

.MACRO	ALERR MES		;Bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	.ENDM

.MACRO	PUNT MES		;Really bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	MOV #PNTMES,-(SP)	;Push the "Can't continue" message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	BR .-10			;Loop forever or until he gives up
	.ENDM

SPSWITCH == 0	;0 => code, 1 => data

.MACRO	CODE	     ;The following is code, it should go in instruction space
	.IFNZ SPSWITCH
	DATA$ == .
	.OFFSET -340000		;For code virtual 0 → physical 340 000
	. == CODE$
	SPSWITCH == 0
	.ENDC
	.ENDM

.MACRO	DATA	     ;The following is data, it should go in data space
	.IFZ SPSWITCH
	CODE$ == .
	.OFFSET -160000		;For data virtual 0 → physical 160 000
	. == DATA$		;Change MAP_OFFSET in ALAID.SAI if offset is changed
	SPSWITCH == 1
	.ENDC
	.ENDM

;Separate assembly communication facility COMTAB

COMMENT  ⊗  All locations local to one assembly which need
to be known to the others are listed here. They are all virtual addresses. ⊗

COMTAB == 0		;Communication table (256 words)
IPATCH == 0		;Code Space Patch area (256 words)
START == 1000		;Kernel initialization address (physical address)
INIT  == 1004		;Kernel initialization address (physical address)
DPATCH == 1000		;Data Space Patch area (256 words)
ARMCOD == 1006		;Beginning of the arm code		7.2K of 11.5K
ARMDAT == 2000		;Beginning of the arm code data space	5.5K of  7.5K
INTCOD == 60000		;Beginning of the interpeter code	8.1K of 12.0K
INTDAT == 50000		;Beginning of the interpeter data space	3.0K of  8.0K
PCODE = 100000		;Pseudo-code start address		  up to 12.0K

;The following is the COMTAB.  It has room for =128 labels.

;_____________________________________________________________
 VERSION == 23		;Change this if you change COMTAB!!! |
;-------------------------------------------------------------

. = COMTAB
SAILID::.WORD CPOINTY	;SAIL program ID. 0 means standalone (Phys. addr: 160 000)
			;		  1 means POINTY
			;		  2 means random 10 program (e.g. GAL)
NOTB10::.BLKW 16	;Used by ALAID to talk to the 10  (Phys. addr: 160 002)
NOSTRT:	.WORD 0		;Tells SAIL if need to restart program.(addr:  160 036)
NOTB11::.BLKW 20	;				  (Phys. addr: 160 040)


HIADDR::.WORD 0		;Where the pcode ends & where free storage starts
ARMVER::.WORD 0		;What the arm code thinks VERSION is.
PCDVER::.WORD 0		;What the pcode thinks PCVERSION is.

			;Entry in ALIO.PAL[AL,HE]
LERRTRAP::.WORD 0	;Call this to print an error message.
LTYPSTR:: .WORD 0	;Call this to print a string
LINSTR::  .WORD 0	;Call this to read in a string

			;The follow entry points are located in ARM.PAL[AL,HE]
LINTARM::.WORD 0	;Arm initialization
LFINARM::.WORD 0	;Kill arm servo job
LMOVPOS::.WORD 0	; used by POINTY
LCALIB:: .WORD 0	;Puma calibration
LCENTER::.WORD 0	;Center routine
LWHERE:: .WORD 0	;Where routine
LMOVE::	.WORD 0		;Move routine
LOPERATE::.WORD 0	;Operate routine
LERRPTR::.WORD 0	;All error torques:  indirect table
LTHPTR::.WORD 0		;All theta:  joint angle indirect table
LDVCPTR::.WORD 0	;Device block ptrs for attached servos
LSETBAS::.WORD 0	;Force wrist set base routine
LWRIST::.WORD 0		;Force wrist resolving routine
LSETC::	.WORD 0		;Force sensing and compliance system initialization
LFRCSIG::.WORD 0	;Initializes job starting, based upon a force reading
LFRCOFF::.WORD 0	;Takes a queued job off of the force signal list
LBISON::.WORD 0		;Sets up bias force of a given magnitude and direction
LBISOFF::.WORD 0	;Turns off bias force in a specified direction
LPOTPTR::.WORD 0	;Addresses for pot readings
LSETSTF::.WORD 0	;Sets up stiffness of arm for next motion
LGATHER::.WORD 0	;Gathers forces sensed by wrist during motion

			;The follow entry points are located in ARITH.PAL[AL,HE]
LSQRTF::.WORD 0		;Square root routine
LEXP::	.WORD 0		;Raise e to a power routine
LLOG::	.WORD 0		;Natural Log routine
LSNCSD::.WORD 0		;Sin&Cos routine (degrees)
LASIN::	.WORD 0		;Asin routine (degrees)
LACOS::	.WORD 0		;Acos routine (degrees)
LATAN2::.WORD 0		;Atan2 routine (degrees)

			;The follow entry points are located in ARMSOL.PAL[AL,HE]
LUPDATE::.WORD 0	;Arm solution to go from joint angles to transform
LSOLVE:: .WORD 0	;Arm solution to go from transform to joint angles


			;The following entry point is located in BEJCZY.PAL
LDTERMS::.WORD 0	;Computes gravity loading and inertia for joints

			;The following entry point is located in EULER.PAL
LEULER::.WORD 0		;Get the Euler angle

			;The following entry points are located in PARM.PAL[PNT,HE]
			;for auxilliary move commands
			; which compute the polynomials at runtime
LRFORCE::.WORD	0	;returns force values to the 10
LSETSPEED::.WORD 0	;address of setspeed factor
LDRV0:: .WORD 0
LDRIVE::.WORD 0
LUSTPPTR::.WORD 0	;ptr to upper stop limits
LLSTPPTR::.WORD 0	;ptr to lower stop limits
LCALFLG::.WORD 0	;puma calibration flag
LKBDRTN::.WORD 0	;address of keyboard joystick control routine

			;the following entry points are in FLOAT.PAL[AL,HE
LCVF::.WORD 0
LTYPCHR::.WORD 0	; ALIO2.PAL
LINCHR::.WORD 0		; ALIO2.PAL
COMMENT ⊗
If you want to define where, say, DRIVE is, you should do this:
	PUTLOC LDRIVE, DRIVE
If you want to call, say, GETVAL, you should do this:
	JSR PC,@LGETVAL
⊗